package com.yww.controller;

import com.yww.mapper.ResultsMapper;
import com.yww.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class QuartzController {
    @Autowired
    private UsersService usersService;
    @Autowired
    private ResultsMapper resultsMapper;
    @Scheduled(cron = "00 00 00 * * ?")
    public void restSta(){
        usersService.updateStatus();
        usersService.updateTime();
    }
    @Scheduled(cron = "00 30 22 * * ?")
    public void Qztuichu(){
        usersService.updateStatus2();
    }

    //每月二十号9点15执行
    @Scheduled(cron = "00 00 00 28 * ?")
    public void print2() {
        resultsMapper.addResults();
        System.out.println("aaaaaaa");

    }
}
